package javachongkao.编程基础.生成前五十个质数;

import java.util.Scanner;
//7-66 First 50 Prime Numbers
//分数 10
//作者 翁恺
//单位 浙江大学
//Your program reads one natural numbers n in,  and prints out the sum of the first n prime numbers starting from 2.
//
//Input Format:
//A positive whole numbers n, which is less than 10
//3
// .
//
//Output Format:
//A number which is the sum of all the first n prime numbers.
public class Main{
    public static void main(String[] args){
        Scanner cin=new Scanner(System.in);
        int n=cin.nextInt();
        int sum=0;
        int i=0;
        int x=2;
        while(i!=n)
        {
            if(is_prime(x))
            {
                sum+=x;
                i++;
            }
            x++;

        }
        System.out.print(sum);

    }
    public static boolean is_prime(int x)
    {
        for(int i=2;i*i<=x;i++)
        {
            if(x%i==0)
            {
                return false;
            }
        }
        return true;
    }
}

